// 宠物提醒管理相关 api
// 使用统一的请求封装

import request from '@/utils/request';

// 获取提醒列表
export function getreminderlist(params = {}) {
  return request({
    url: '/system/reminder/list',
    method: 'get',
    data: params
  }).then(data => {
  
    return data;
  }).catch(err => {
  
    throw err;
  });
}

// 获取提醒详情
export function getreminderdetail(reminderid) {
  return request({
    url: `/system/reminder/${reminderid}`,
    method: 'get'
  }).then(data => {
  
    return data;
  }).catch(err => {
  
    throw err;
  });
}

// 添加提醒
export function addreminder(data) {
  return request({
    url: '/system/reminder',
    method: 'post',
    data
  }).then(data => {
    // 返回完整的数据，包含reminderId
    return data;
  }).catch(err => {
  
    throw err;
  });
}

// 更新提醒
export function updatereminder(reminderid, data) {
  return request({
    url: '/system/reminder',
    method: 'put',
    data: {
      ...data,
      id: reminderid
    }
  }).then(data => {
  
    return data;
  }).catch(err => {
  
    throw err;
  });
}

// 删除提醒
export function deletereminder(reminderid) {
  return request({
    url: `/system/reminder/${reminderid}`,
    method: 'delete'
  }).then(data => {
  
    return data;
  }).catch(err => {
  
    throw err;
  });
}

// 更新健康记录的提醒ID
export function updateHealthReminder(data) {
  return request({
    url: '/system/reminder/updateHealthReminder',
    method: 'put',
    data
  }).then(data => {
  
    return data;
  }).catch(err => {
  
    throw err;
  });
}